add_custom_command(OUTPUT ffilter.pot
                   COMMAND xgettext -d ffilter -k_ -o ffilter.pot ${CMAKE_CURRENT_SOURCE_DIR}/../ffilter.c
                   DEPENDS ../ffilter.c)

add_custom_target(pot DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ffilter.pot)

add_custom_command(OUTPUT ru.mo
                   COMMAND msgfmt -c -o ru.mo ${CMAKE_CURRENT_SOURCE_DIR}/ru.po
                   DEPENDS ru.po)

add_custom_command(OUTPUT uk.mo
                   COMMAND msgfmt -c -o uk.mo ${CMAKE_CURRENT_SOURCE_DIR}/uk.po
                   DEPENDS uk.po)

add_custom_target(po ALL DEPENDS
                  ${CMAKE_CURRENT_BINARY_DIR}/ru.mo
                  ${CMAKE_CURRENT_BINARY_DIR}/uk.mo)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ru.mo
        DESTINATION ${CMAKE_INSTALL_PREFIX}/locale/ru/LC_MESSAGES
        RENAME ffilter.mo)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/uk.mo
        DESTINATION ${CMAKE_INSTALL_PREFIX}/locale/uk/LC_MESSAGES
        RENAME ffilter.mo)
